var newsTable;
// 获取基础数据信息
function getsecretkeylList() {
	if (typeof newsTable !== 'undefined') {
		newsTable.fnPageChange('first');
		return;
	}

	var i = 1;
	newsTable = $("#newsList")
			.DataTable(
					{
						"sAjaxSource" : _path + "/secretkeyl/queryByPage",
						"fnServerParams" : function(aoData) {
							aoData.push({
								"name" : "userNickName",
								"value" : $("#userNickName").val()
							},{
								"name" : "fromDate",
								"value" : $("#fromDate").val()
							}, {
								"name" : "toDate",
								"value" : $("#toDate").val()
							}, {
								"name" : "liveId",
								"value" : $("#liveId").val()
							});
						},
						"sServerMethod" : "POST",
						"sAjaxDataProp" : "dataList",
						"fnCreatedRow" : function() {
							i++;
						},
						"fnPreDrawCallback" : function() {
							i = 1;
						},
						"aoColumns" : [
								{
									"sTitle" : "序号",
									"sWidth" : "2%",
									"mData" : function() {
										return i;
									}
								},
								{
									"sTitle" : "秘钥",
									"mData" : "passwork",
									"sWidth" : "10%",
									"mRender" : function(data) {
										var te;
										if(data!==""){
											te=data;
										}else{
											te=" ";
										}

										return te;
									}
								},
								{
									"sTitle" : "昵称",
									"mData" : "userNickName",
									"sWidth" : "10%",
									"mRender" : function(data) {
										var te;
										if(data!==""){
											te=data;
										}else{
											te=" ";
										}

										return te;
									}
								} ,
								{
									"sTitle" : "创建时间",
									"mData" : "createTime",
									"sWidth" : "10%"
								} ,
								{
									"sTitle" : "操作",
									"sWidth" : "10%",
									"mData" : function(data) {
					            		var status = '<a href="' + _path + '/secretkeyl/edit?id=' + data.id + '&liveId=' + data.liveId + '" class="btn default btn-xs purple"><i class="fa fa-edit" title="编辑"></i></a>';
				                        status += '&nbsp;<a href="javascript:inquiry('+data.id+')"  class="btn default btn-xs red"><i class="fa fa-trash-o" title="删除"></i></a>';
										return status;
									}
								} ]
					});
}
function inquiry(id){
	layer.confirm('您确定要删除吗？', {
		  btn: ['确定','取消'] //按钮
		}, function(){
			layer.closeAll('dialog');
			$.ajax({
				url : _path + "/secretkeyl/del/" + id,
				type : "get",
				dataType : "json",
				async : false,
				error : function(request) {
					alert("连接错误！");
				},
				success : function(data) {
					  if(data.msg=='成功'){
						  layer.close
						  App.bubble(200, "删除成功");
						  getsecretkeylList();
					  }else{
						  App.bubble(200, "删除异常");
					  }
				}
			});
		//	location.href = _path + "/evaluationProject/del/" + id;
		}, function(){
		
		});

}